<template>
	<view>
		<swiper class="imageContainer" previous-margin="80rpx" next-margin="80rpx">
			<swiper-item class="swiperitem" v-for="(item,index) in ctlist" :key="index">
				<view class="kkjjrert pr ov act" v-if="item.status ==1">
				<!-- <view class="kkjjrert pr ov" v-if="item.status == 0"> -->
					<view class="cen jkjcrttt">
						<image src="../../static/img/cheliang.png" class="cheliangdert cz"></image>
						<view class="cf fz50 mt20">
							{{item.name}}
						</view>
						<view class="cf fz28 mt10">
							{{item.license_full}}
						</view>
					</view>
					<view class="jkjhkxert row cen fz32">
						<view class="col dftrtwwrrt" v-if="item.type ==1">
							我的车
						</view>
						<view class="col dftrtwwrrt" v-if="item.type ==2">
							借的车
						</view>
						<view class="jhhertter ls " v-if="item.status ==1">
							当前车辆
						</view>
					</view>
				</view>
				<!-- <view class="kkjjrert pr ov act" v-if="item.status ==1"> -->
				<view class="kkjjrert pr ov" v-if="item.status == 0">
					<view class="cen jkjcrttt">
						<image src="../../static/img/cheliang.png" class="cheliangdert cz"></image>
						<view class="cf fz50 mt20">
							{{item.name}}
						</view>
						<view class="cf fz28 mt10">
							{{item.license_full}}
						</view>
					</view>
					<view class="jkjhkxert row cen fz32">
						<view class="col dftrtwwrrt" v-if="item.type ==1">
							我的车
						</view>
						<view class="col dftrtwwrrt" v-if="item.type ==2">
							借的车
						</view>
						<view class="jhhertter ls " @tap="qiehuan(item.id,item.devsn)">
							切换
						</view>
					</view>
				</view>
			</swiper-item>
		</swiper>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				jhgfr: [{
						cls: "act"
					},
					{
						cls: ""
					},
					{
						cls: ""
					}
				],
				ctlist:[]
			}
		},
		components: {

		},
		onLoad(){
			let clist= this.carlist()
		},
		methods: {
			async carlist(){
				let clist=await this.get('/api/car/3/my')
				console.log("我的车",clist)
				this.ctlist=clist.data
			},
			async qiehuan(carid,devsn){
				let params={}
				let shcar=await this.get('/api/car/'+carid+'/switch',params,'PUT')
				console.log("切换车辆",shcar)
				// this.dqGetDevInfo(devsn)
				// this.$store.commit('setintdevsn',devsn)
				// this.$store.commit('setisintcar', false)
				// if(ccar){
				if(this.$store.state.isintcar && this.$store.state.intdevsncar){
					this.delDeviceInfo()
				}
				// }
				uni.switchTab({
					url:"/pages/zhongjianbtn/index"
				})
			}
		},
		mounted() {}
	}
</script>
<style scoped>
	.imageContainer {
		width: 750upx;
		height: 708upx;
		margin-top: 250upx;
	}

	.kkjjrert {
		width: 536upx;
		height: 708upx;
		background-color: #A2A2A2;
		border-radius: 12rpx;
	}

	.swiperitem {
		width: 536upx;
		height: 708upx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.cheliangdert {
		width: 246upx;
		height: 246upx;
	}

	.jkjcrttt {
		padding-top: 96upx;
	}
	.jkjhkxert{
		height: 130upx;
		line-height: 130upx;
		position: absolute;
		width: 100%;
		left: 0;
		bottom: 0;
		background: #fff;
	}
	.jhhertter{
			width: 318upx;
	}
	.dftrtwwrrt{
		background-color: #A2A2A2;
		color: #fff;
	}
	.kkjjrert.act,.kkjjrert.act .dftrtwwrrt{
		background-color: #1689D5;
	}
	.kkjjrert.act .jhhertter.ls{
		color: #333 !important;
	}
</style>
